'use strict';

angular.module('myApp.view1', ['ngRoute','ngCookies'])

.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/view1', {
    templateUrl: 'views/view1/view1.html',
    controller: 'View1Ctrl'
  });
}])

.config(function($locationProvider){
    $locationProvider.html5Mode(false).hashPrefix('!');
})
.controller('View1Ctrl', ["$scope","serData","$cookieStore","$location","$cacheFactory",function($scope,serData,$cookieStore,$location,$cacheFactory) {
/*
    var cache = $cacheFactory('cache01');
    cache.put('name','sdsadas');
    cache.put('strings','sdsadas');

    serData.success(function(data,status,headers,config) {
      $scope.names=data[0].name
    }).error(function(data,status,headers,config) {
      console.log(data)
    });
    $cookieStore.put("name","huahuadavids")
    console.log($cookieStore.get("name"))
    */
    console.log($location.path())//   /view
    console.log($location.url())//  /view?name=huaua
    console.log($location.absUrl())
    $scope.loc=function(){
        $location.path('/login').search({name: "huahuadavids"});
        $location.replace();//跳转到时不添加新的历史记录
    }
   // console.log($location.path("./view2"))
   // $cookieStore.remove("name")
}]);